<h1>Ladder Page</h1>

<style type="text/css">
A:link {
	text-decoration: none;
	color: #BCC1DD;
}

A:visited {
	text-decoration: none;
	color: #BCC1DD;
}

A:active {
	text-decoration: none
}

A:hover {
	font-size: 2430;
	font-weight: bold;
	color: #0099FF;
}
</style>

<script
	src="<?php echo base_url(); ?>js/jquery.js" type="text/javascript"></script>
<script
	src="<?php echo base_url(); ?>js/jquery.tablesorter.min.js"
	type="text/javascript"></script>
<script
	src="<?php echo base_url(); ?>js/jquery.boxy.js" type="text/javascript"></script>
<link
	rel="stylesheet" href="<?php echo base_url(); ?>css/boxy.css"
	type="text/css" />

<script type="text/javascript">
	$(document).ready(function() {
		$("#mainTable").tablesorter({cancelSelection: true});
	});
</script>

<script type="text/javascript">
	function setChallengeTarget(name){
		document.getElementById('challenge_form').target.value = name;
	}
</script>

<?php

if (isset($challenge_status)){
	echo heading($challenge_status, 2);
}

$tmpl = array (
    	'table_open'          => '<table id="mainTable" class="tablesorter" border="6"  style="backgroud-color: #101225 ;" color="BCC1DD">',
        'heading_row_start'   => '<tr class="heading" id="table_headingstart">',
        'heading_row_end'     => '</tr>',
        'heading_cell_start'  => '<th id="table_header" class="header" style="cursor: pointer;" >',
        'heading_cell_end'    => '</th>',

        'row_start'           => '<tr id="table_rowstart">',
        'row_end'             => '</tr>',
        'cell_start'          => '<td  id="main_content">',
        'cell_end'            => '</td>',

        'row_alt_start'       => '<tr id="table_rowaltstart">',
        'row_alt_end'         => '</tr>',
        'cell_alt_start'      => '<td id="table_footer">',
        'cell_alt_end'        => '</td>',

        'table_close'         => '</table>'
        );



        $table_library->set_template($tmpl);

        $table_library->set_heading('Rank', 'Name', 'Score', 'Wins', 'Losses', 'Ratio', 'Challenge');
        echo $table_library->generate($ladder_table);
        ?>

<div id='hidden_form' style='display: none; color: black'>
<?php
echo 'Are you sure you want to challenge?' . br(1);
echo 'Challenging options (such as map bans) will go here in the future.' . br(2);
echo form_open('ladder/issue_challenge', array('id' => 'challenge_form'));
echo form_hidden('target', '');
echo form_submit('submit', 'Challenge');
?>
	<input type="button" onclick="Boxy.get(this).hide();"
		id="challenge_close" value="Cancel" />
</div>

<h1>Rules</h1>
<div style="position: relative" id="ladder_rules">
	<fieldset>
		<legend>Ladder Rules</legend>
		<?php
		$maps = $this->config->item('active_maps');

		echo 'A challenge must be played within 7 days or the match is cancelled' . br(2);
		echo '1) The player receiving the challenge chooses first map' . br(1);
		echo '2) Map pool: ' ;

		$last_map = end($maps);
		foreach ($maps as $map){
			if ($map != ''){
				echo $map . ($map != $last_map ? ', ' : '');
			}
		}

		echo br(1);
		echo '3) Matches are best of 3' . br(1);
		echo '4) Uploading replays is optional' . br(1);
		?>
	</fieldset>
</div>
